<?php

abstract class CC_Helpdesk_Action_Abstract  
{
    /**
     * @var CC\Entity\Ticket Ticket entity
     */
    protected $_ticket;
    /**
     * @var array Parameter array
     */
    protected $_params;
    /**
     * @var Doctrine\ORM\EntityManager Doctrine entity manager 
     */
    protected $_em;
    
    /**
     * Abstract function to parse the specific ticket action
     */
    abstract public function parse();
    
	/**
     * Ticket accessor
     * @return CC\Entity\Ticket
     */
	public function getTicket()
    {
        return $this->_ticket;
    }
    
    /**
     * Return parameter array
     * @return array
     */
    public function getParams()
    {
        return $this->_params;
    }
    
    /**
     * Return a specific element from the parameter array
     * @param string $key
     * @return mixed
     */
    public function getParam($key)
    {
        if(isset($this->_params[$key]))
            return $this->_params[$key];
            
        return null;
    }
    
    /**
     * Return the doctrine entity manager
     */
    public function getEntityManager()
    {
        return $this->_em;
    }
    
	/**
     * Ticket mutator
     * @param CC\Entity\Ticket $ticket
     */
	public function setTicket(CC\Entity\Ticket $ticket)
    {
        $this->_ticket = $ticket;
        return $this;
    }
    
    /**
     * Param mutator. Sets the parameters using the array supplied
     * @param array $params Param array
     */
    public function setParams($params = array())
    {
        $this->_params = $params;
        return $this;
    }
    
    /**
     * Param mutator. Set a specific parameter
     * @param string $key
     * @param mixed $value
     */
    public function setParam($key, $value)
    {
        $this->_params[$key] = $value;
        return $this;
    }
    
    /**
     * Set the entity manager
     * @param Doctrine\ORM\EntityManager $em
     */
    public function setEntityManager(Doctrine\ORM\EntityManager $em)
    {
        $this->_em = $em;
        return $this;
    }
}
?>